﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace JobbJaktWeb
{
    public partial class UserMasterPage : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(Session["Authorization"] != null)
            Button1.Text = "Logout";
            if (Session["Username"] != null)
            {
                Label1.Visible = true;
                Label2.Visible = true;
                Label2.Text = Session["Username"].ToString();
            }
            else
            {
                Label1.Visible = false;
                Label2.Visible = false;
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Button1.Text == "Logout")
            {
                Session["Authorization"] = null;
                Session["Username"] = null;
                Response.Redirect("Home.aspx");
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
    }
}